<%@ page language="java" import="java.util.*,office.BusiUtil" pageEncoding="UTF-8"%>
<%@include file="/common/jsp/taglibs-nojs-nocss.jsp"%>
<%@ page isELIgnored="false" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div id="pop_up_content">
	<div class="pop_up_title images_13">
		编辑加班申请单
	</div>
	<div class="pop_up_body">
		<form id="thisForm" action="saveOverTime.action" method="post" >
		<table border="0" cellpadding="0" cellspacing="0"  width="400">
			<tr>
				<td>
					<div class="form_input_value">
						加班人
					</div>
				</td>
				<td>
					<input type="hidden" name="overTimeVo.user.id" value="<s:property value='#session.user.userId'/>" >
					<input type="hidden" name="overTimeVo.status" value="1" >
					<input type="text" disabled="disabled" value="<s:property value='#session.user.userCname'/>" >
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						加班开始时间
					</div>
				</td>
				<td>
					<input type="text" id="beginDate" onclick="WdatePicker();" name="overTimeVo.beginDate" value="" class="longinput required" >
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						加班结束时间
					</div>
				</td>
				<td>
					<input type="text" id="endDate" onclick="WdatePicker();" name="overTimeVo.endDate" onchange="return validateDate();" value="" class="longinput required" >
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						加班时长
					</div>
				</td>
				<td>
					<input type="text" id="sumTime" name="overTimeVo.sumTime" value="" class="longinput required" >
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						审批人
					</div>
				</td>
				<td>
					<s:select id="listUser" list="listUser" name="overTimeVo.processUser.id" headerKey="" headerValue="请选择" listKey="id" listValue="cname" value="overTimeVo.processUser.id" theme="simple" cssClass="required"/>
				</td>
			</tr>
			<tr>
				<td>
					<div class="form_input_value">
						加班原因
					</div>
				</td>
				<td>
					<input type="text" id="reson" class="longinput" name="overTimeVo.reson" value="">
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<input id="thisButton" type="button" value="提交" class="btn" onmouseout="this.className='btn'" onmousedown="this.className='btn1'" onmouseover="this.className='btn2'">
					<input type="button" value="取消" class="btn" onclick="hideDialog();" onmouseout="this.className='btn'" onmousedown="this.className='btn1'" onmouseover="this.className='btn2'">
				</td>
			</tr>
		</table>
		</form>
	</div>
</div>
<script>
	function validateDate(){
		var beginDate = document.getElementById('beginDate').value;
		var endDate = document.getElementById('endDate').value;
		if(beginDate == "" || endDate == ""){
			alert("起止时间不能为空！");
			return false;
		}
		beginDate=beginDate.replace(/-/g,"/");     
		endDate=endDate.replace(/-/g,"/");
		var   date1   =   Date.parse(beginDate);     
		var   date2   =   Date.parse(endDate);
		if(beginDate > endDate){
			alert('日期输入不合法！开始时间不能晚于结束时间。');
			document.getElementById('beginDate').value = "";
			document.getElementById('endDate').value = "";
			return false;
		}else{
			document.getElementById('sumTime').value = (date2-date1)/(60*60*1000*24)+1;
		}
	}
	/* 表单提交 */
	i.formSubmit("thisButton",	//绑定的按钮id
					  "thisForm" ,   //提交的表单id
					  function(result){
						  	var jsonMsgObj=new JsonMsgObj(result);
							var  msg=jsonMsgObj.getMessage();
						    var codeId=jsonMsgObj.getCodeid();
							var isOk=jsonMsgObj.getIsok();
							if( isOk ){
							    aerouiAlert(msg);
								hideDialog();// 隐藏窗口
								window.location.reload();
							}else{		// 如果编辑失败了
							  JsManageInfoHandleException( result , function(msg , codeId , isOk){
							  		hideDialog();// 隐藏窗口
							   });
						   }
						});
</script>